package groovy

def pickEven(n,block){
    for(i=2;i<=n;i=i+2){
        block(i);
    }

}
int total=0
pickEven(10){total+=it}
    println("sum is ${total}")